package com.example.administrator.onepagelibrary.presenter.fragment;


import com.example.administrator.commonlibrary.bean.MyBean;
import com.example.administrator.commonlibrary.contract.fragment.one.OneFragmentContract;
import com.example.administrator.commonlibrary.utils.LogUtil;
import com.example.administrator.onepagelibrary.model.fragment.OneFragmentModule;
import com.example.administrator.onepagelibrary.onebase.OneBasePresenterImpl;

import javax.inject.Inject;

import io.reactivex.functions.Consumer;
/**
 * @author wang_hong_wei
 * @description
 * @Date 2018-5-11
 */

public class OneFragmentPresenter extends OneBasePresenterImpl<OneFragmentContract.View> implements OneFragmentContract.Presenter {

    private final OneFragmentModule module;
    @Inject
    MyBean myBean;
    @Inject
    public OneFragmentPresenter(){
        module = new OneFragmentModule(this);
    }

    @Override
    protected void attachView() {

    }

    public Consumer addSubscription(){
      return new Consumer() {
            @Override
            public void accept(Object o) throws Exception {
                if (o instanceof MyBean){
                    //这种实例化 由于封装的原因，不能再p层的构造方法中使用
                    LogUtil.d(myBean.getMessage() + "-实验p层Dagger实例化对象-" + myBean.getErrorCode());
                   mView.setToast();
                }
            }
        };
    }
}
